<?php
$this->breadcrumbs = array(
    '网关测试'
);
?>
<?php
$form = $this->beginWidget('bootstrap.widgets.TbActiveForm', array(
    'id' => 'search-form',
    'type' => 'search',
    'method' => 'GET',
    'htmlOptions' => array('class' => 'navbar-search pull-left', 'style' => 'margin:0;width:100%;'),
));
?>
<div class="submenu">

    <div class="row">
        <div class="col-md-12">
            <?php
            $this->widget('bootstrap.widgets.TbButton', array(
                'label' => '测试',
                'htmlOptions' => array('class' => 'pull-right btn-success test', 'style' => 'width:100%'),
                'url' => $this->createUrl('test'),
            ));
            ?>
        </div>
    </div>

</div>
<?php
$this->endWidget();
?>


<div class="col-md-12">
    <?php
    echo CHtml::textArea('result','请耐心等待！！',['id'=>'test_result','style'=>'width:100%;min-height: 500px']);
    ?>
</div>


<script type="text/javascript">
    $(function ($) {
        function update_area($data) {
            $('#test_result').val('');
            $('#test_result').val($data);
        }

        $(document).on('click', 'a.test', function () {
            if (!confirm('确定测试?')) return false;
            var th = this;
            $.ajax({url:$(this).attr('url'),type:'GET',success:function(data){
                if (data == 'Success') {
                    alert('success');
                    update_area('全部通道测试成功！');
                } else {
                    alert('测试失败，请截图结果联系管理员。');

                    update_area(data);
                }
            }});
            return false;
        });
    });


</script>







